﻿using System.ComponentModel.DataAnnotations;
using System.Xml.Serialization;

namespace SelfService.XinXing.Models
{
    [XmlRoot("Request")]
    public class HisRequestBase
    {
        [XmlElement("method")]
        public string Method { get; set; }
    }

    [XmlRoot("Request")]
    public class HisQrCodeRequest
    {
        /// <summary>
        /// 交易代码
        /// </summary>
        public string TranCode { get; set; } = "1004";

        /// <summary>
        /// 充值金额
        /// </summary>
        [Required]
        public decimal TotalAmount { get; set; }

        /// <summary>
        /// 用户卡号
        /// </summary>
        [Required]
        public string CardNo { get; set; }

        /// <summary>
        /// 标题
        /// </summary>
        [Required]
        public string Caption { get; set; }

        /// <summary>
        /// 描述
        /// </summary>
        [Required]
        public string Descriptive { get; set; }

        /// <summary>
        /// 支付方式
        /// </summary>
        public string Zffs { get; set; }

        /// <summary>
        /// 操作员ID
        /// </summary>
        [Required]
        public string UserId { get; set; }

        public string Ip { get; set; }

    }

    [XmlRoot("Response")]
    public class HisQrCodeResponse
    {
        public string ResultCode { get; set; }

        public string ErrorMsg { get; set; }

        public string OutTradeNo { get; set; }

        public string TwoDimensionCode { get; set; }
    }

    public enum HisResultCodeEnum
    {
        成功,
        失败,
        空值
    }

    /// <summary>
    /// 新星HIS查询支付结果请求
    /// </summary>
    [XmlRoot("Request")]
    public class HisPayResultRequest
    {
        public string TranCode { get; set; } = "1008";

        public string TradeNo { get; set; }

        /// <summary>
        ///  外部订单号
        /// </summary>
        [Required]
        public string OutTradeNo { get; set; }

        /// <summary>
        /// 诊疗卡号
        /// </summary>
        [Required]
        public string CardNo { get; set; }

        /// <summary>
        /// 操作员ID
        /// </summary>
        [Required]
        public string UserId { get; set; }


        public string Zffs { get; set; } = "0E";

        public string Ip { get; set; }
    }

    /// <summary>
    /// 新星HIS查询支付结果返回
    /// </summary>
    [XmlRoot("Response")]
    public class HisPayResultResponse
    {
        public string ResultCode { get; set; }

        public string ErrorMsg { get; set; }

        public string OutTradeNo { get; set; }

        public string TradeNo { get; set; }


        public decimal TotalAmount { get; set; }

        public string RefundAmount { get; set; }

        /// <summary>
        /// WAIT_BUYER_PAY 交易创建, 等待卖家付款
        /// TRADE_SUCCESS 支付成功, 调用充值接口进行充值
        /// TRADE_CLOSED 交易中途关闭
        /// ILLEGAL_ARGUMENT 两个输入参数未赋值
        /// TRADE_NOT_EXIST 交易号不存在
        /// SYSTEM_ERROR 支付宝系统错误
        /// TRADE_FINISHED 交易成功结束, 交易三个月之后无法进行退款
        /// </summary>
        public string TradeStatus { get; set; }
    }

    /// <summary>
    /// 新星HIS充值请求
    /// </summary>
    [XmlRoot("Request")]
    public class HisCreditRequest
    {
        public string TranCode { get; set; } = "1005";

        public string CardNo { get; set; }

        public decimal TotalAmount { get; set; }

        public string TradeNo { get; set; } = string.Empty;

        public string OutTradeNo { get; set; }

        public string Zffs { get; set; } = "0E";

        /// <summary>
        /// 交易日期 2018-03-26 16:37:42
        /// </summary>
        public string Jyrq { get; set; }

        /// <summary>
        /// 操作员编号
        /// </summary>
        [XmlElement("OperatorID")]
        public string OperatorId { get; set; }


        public string UserId { get; set; }

        [XmlElement("ip")]
        public string Ip { get; set; }
    }

    /// <summary>
    /// 新星HIS充值返回
    /// </summary>
    [XmlRoot("Response")]
    public class HisCreditResponse
    {
        public string ResultCode { get; set; }

        public string ErrorMsg { get; set; }

        public string OutTradeNo { get; set; }
    }

}
